Assignemnt #37 and Thirty-fourth Program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: Thirty-fourth Program
///File name: ThirfoProg.java
///Date Finished:10/5/2015
import java.util.Scanner;
public class ThirfoProg
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String name;
int age;
System.out.print( "Hey, What's your name? (Sorry, I keep forgetting.) " );
name = keyboard.next();
System.out.print( "Okay, " + name + ", how old are you?" );
age = keyboard.nextInt();
if(age < 16)
{
System.out.println( "You can't drive." );
}
if(age >= 16 && age <= 17)
{
System.out.println( "You can drive but not vote." );
}
if(age >= 18 && age < 24)
{
System.out.println( "You can vote but you cant rent a car." );
}
if(age >= 25)
{
System.out.println( "You can do pretty much anything." );
}
}
}
Picture of the output